<?php
/**
 * Created by PhpStorm.
 * User: dreamy
 * Date: 2019-05-30
 * Time: 15:21
 */
namespace common\models;

use Yii;

/**
 * This is the model class for table "tally_account".
 *
 * @property int $id 账户ID
 * @property string $title 账户名称
 * @property int $tally_id 账本ID
 * @property int $uid 创建者
 * @property int $type 账户类型
 * @property int $currency_id 币种
 * @property string $money 余额
 * @property int $is_sys 系统默认
 * @property string $memo 备注
 * @property string $created_time 创建时间
 * @property string $updated_time 更新时间
 */
class TallyAccount extends \yii\db\ActiveRecord
{
    /**
     * 入账账户
     */
    const ACCOUNT_TYPE_IN = 1 ;

    /**
     * 出账账户
     */
    const ACCOUNT_TYPE_OUT = 2 ;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'tally_account';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['uid', 'tally_id','type', 'currency_id', 'is_sys'], 'integer'],
            [['initial_money','money'], 'number'],
            [['tag'], 'string'],
            [['uid','tally_id','type','title'], 'required'],
            [['created_time','memo', 'updated_time'], 'safe'],
            [['title'], 'string', 'max' => 60],
            [['memo'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => 'Title',
            'tally_id' => 'Tally Id',
            'uid' => 'Uid',
            'type' => 'Type',
            'tag' => 'Tag', //标签标识
            'currency_id' => 'Currency ID',
            'money' => 'Money',
            'initial_money' => 'Initial Money', //初始金额
            'is_sys' => 'Is Sys',
            'memo' => 'Memo',
            'created_time' => 'Created Time',
            'updated_time' => 'Updated Time',
        ];
    }



}
